<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%> 
    <link rel="stylesheet" href="${ctxStatic}/css/DateTimePicker.css">
 <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
 <script src="${ctxStatic}/DateTimePicker/DateTimePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
        <script type="text/javascript">
            $(document).ready(function(){
            	$(window.parent.$("#dtBox1")).DateTimePicker({
                  dateFormat:"yyyy-MM-dd",
                  parentElement:".timeBox",
               });
            })
           //重置
           function clean(){
               // input赋值空
               $("input").val("");
               // 添加表单
               $("#searchForm").submit();
           }
        </script> 
    </head>
    <body>
        <!-- 初始化方法 -->
        <form  id="searchForm" action="${ctx}/sys/log/list" method="post">
            <div class="listSearchBox clearfix">
            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                <div class="searchLeft clearfix" style="width: calc(100% - 200px);">
                    <div class="searchSm clearfix">
                        <!-- 操作菜单-->
                        <p class="searchTxt"><spring:message code="log_logTitle"/></p>
                        <div class="searchInp">
                            <input type="text"  id="logTitle"  name="logTitle" maxlength="22"  value="${log.logTitle}" >
                        </div>
                    </div>
                    <div class="searchSm clearfix">
                        <!-- 操作用户 -->
                        <p class="searchTxt"><spring:message code="log_createUser"/></p>
                        <div class="searchInp">
                        <input type="text"  id="userName"  name="userName" maxlength="22"  value="${log.userName}" >
                        </div>
                    </div>
                    <div class="searchSm clearfix">
                        <!-- URI -->
                        <p class="searchTxt"><spring:message code="log_requestUri"/></p>
                        <div class="searchInp">
                            <input type="text"  id="requestUri"  name="requestUri"  maxlength="50" value="${log.requestUri}" >
                        </div>
                    </div>
                    <div class="searchSm clearfix">
                        <!-- 日期范围 -->
                        <p class="searchTxt"><spring:message code="log_time_range"/></p>
                        <div class="searchInp timeBox timeBoxSm">
                            <input type="text"  id="beginDate"  name="beginDate" class="time startDate1" data-startend="start" data-startendelem=".endDate1" readonly data-field="date" maxlength="50" value="<fmt:formatDate value="${log.beginDate}" pattern="yyyy-MM-dd"/>" >
                        </div>
                        <div class="fl" style="text-align:center;width:15px;line-height:30px;">~</div>
                        <div class="searchInp timeBox timeBoxSm" style="margin:0;">
                            <input type="text"  id="endDate"  name="endDate" class="time endDate1" data-startend="end" data-startendelem=".startDate1" readonly data-field="date" maxlength="50" value="<fmt:formatDate value="${log.endDate}" pattern="yyyy-MM-dd"/>">
                        </div>
                    </div>
                    <div class="searchSm clearfix">
                        <!-- 只查询异常信息 -->
                        <p class="searchTxt"><spring:message code="log_exception"/></p>
                        <div class="searchInp" style="width:15px;">
                            <c:choose>
                                <c:when test="${log.exception!=null&&log.exception!=''}">
                                    <input id="exception" name="exception" type="checkbox" checked="checked"/>
                                </c:when>
                                <c:otherwise>
                                    <input id="exception" name="exception" type="checkbox" />
                                </c:otherwise>
                            </c:choose>
                        </div>
                    </div>
                </div>
               
                <div class="searchRight" style="width:200px;">
                    <!-- 重置 -->
                    <button type="button" class="btn-js" onclick="clean();"><spring:message code="common_reset"/></button>
                    <!-- 查询 -->
                    <button type="button" class="btn-js" onclick="return page();"><spring:message code="commom_check"/></button>
                </div>
            </div>
        </form>
        <div class="tableBox">
            <div class="tableBoxScroll">
                <table cellpadding="0" >
                    <thead>
                        <tr>
                            <!-- No. -->
                            <th><spring:message code="common_no"/></th>
                            <!-- 操作菜单 -->
                            <th><spring:message code="log_logTitle"/></th>
                            <!-- 操作用户 -->
                            <th><spring:message code="log_createUser"/></th>
                            <!-- URI -->
                            <th><spring:message code="log_requestUri"/></th>
                            <!-- 提交方式 -->
                            <th><spring:message code="log_method"/></th>
                            <!-- 操作者IP -->
                            <th><spring:message code="log_remoteAddr"/></th>
                            <!-- 操作者时间 -->
                            <th><spring:message code="log_time"/></th>
                        </tr>
                    </thead>
                    <c:if test="${not empty page.list}" >
                        <tbody>
                            <c:forEach items="${page.list}" var="ct" varStatus="status">
                                <tr>
                                    <td>
                                        <p>${(page.pageNo-1)*page.pageSize + status.index+1}</p>
                                    </td>
                                    <td>
                                        <p>${ct.logTitle}</p>
                                    </td>
                                    <td>
                                        <p>${ct.createBy.firstName}${ct.createBy.lastName}</p>
                                    </td>
                                    <td>
                                        <p >${ct.requestUri}</p>
                                    </td>
                                    <td>
                                        <p>${ct.method}</p>
                                    </td>
                                    <td>
                                        <p>${ct.remoteAddr}</p>
                                    </td>
                                    <td>
                                        <p><fmt:formatDate value="${ct.createDate}" pattern="yyyy-MM-dd HH:mm" /></p>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </c:if>
                </table>
                <c:if test="${empty page.list}" >
                    <div class="tableNone">
                        <img src="${ctxStatic}/images/icon-03.png" height="20"> <spring:message code="There_is_no_data"/>
                    </div>
                </c:if>
            </div>
            <div id="dtBox1"></div>
            <%@ include file="/WEB-INF/views/include/page.jsp"%>
        </div>
        <script>
            var listH = $(':root').css('height');
            $(window.parent.$("#mainFrame").css('height',listH));
            var listH = $(':root').css('height');
            $(window.parent.$("#mainFrame").css('height',listH));
            window.onload = function(){
                var theadW = $('.tabScroll thead').width();
                var theadTh = $('.tabScroll thead tr th').length;
                $('.tabScroll thead tr th').width(theadW/theadTh);
                $('.tabScroll tbody tr:first-child td').each(function(){
                    var indexNum = $(this).index();
                    var tdWidth = $('.tabScroll tbody tr:first-child td').eq(indexNum).css('width');
                    $('.tabScroll thead tr th').eq(indexNum).width(tdWidth);
                });
           }
        </script>
    </body>
</html>